#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

void inherit (void)
{
	printf("I will die...\n");
	return ;
}
void inherit1 (void)
{
	printf("U will die...\n");
	return ;
}
int main(void)
{
	//注册遗言函数
	atexit (inherit);
	atexit (inherit1);
	//创建子进程
	pid_t pid = fork();
	if(-1 == pid){
		perror("fork()");
		return -1;
	}
	if(0 == pid){
		printf("i am child\n");
	}else{
		getchar();
	}
	return 0;
}
